package com.example.demo.Entity;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.HashMap;

public class Video {
    private long id;
    private String title;
    private String intro;
    private String url;
    private String cover;
    private String author_id;
    private Timestamp create_time;
    private Timestamp edit_time;
    private Timestamp recycle_time;
    private int status;
    private long views;
    private long stars;
    private long likes;
    private long partition;
    public Video(){}
    /**
     * 通过键值对设置实体的值
     * @param key 实体的属性名
     * @param value 实体属性要更改的值(Object格式)
     *
     */
    public void setAttribute(String key,Object value)
    {
        switch (key) {
            case "id":
                setId(Long.parseLong(String.valueOf(value)));
                break;
            case "title":
                setTitle(String.valueOf(value));
                break;
            case "intro":
                setIntro(String.valueOf(value));
                break;
            case "url":
                setUrl(String.valueOf(value));
                break;
            case "cover":
                setCover(String.valueOf(value));
                break;
            case "author_id":
                setAuthor_id(String.valueOf(value));
                break;
            case "create_time":
                setCreate_time(Timestamp.valueOf(String.valueOf(value)));
                break;
            case "recycle_time":
                setRecycle_time(Timestamp.valueOf(String.valueOf(value)));
                break;
            case "edit_time":
                setEdit_time(Timestamp.valueOf(String.valueOf(value)));
                break;
            case "status":
                setStatus(Integer.parseInt(String.valueOf(value)));
                break;
            case "stars":
                setStars(Long.parseLong(String.valueOf(value )));
                break;
            case "likes":
                setLikes(Long.parseLong(String.valueOf(value )));
                break;
            case "partition":
                setPartition(Long.parseLong(String.valueOf(value )));
                break;
            default:
                break;
        }
    }
    private String toString(Object value) {
        return String.valueOf(value);

    }
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public String getAuthor_id() {
        return author_id;
    }

    public void setAuthor_id(String author_id) {
        this.author_id = author_id;
    }

    public Timestamp getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Timestamp create_time) {
        this.create_time = create_time;
    }

    public Timestamp getEdit_time() {
        return edit_time;
    }

    public void setEdit_time(Timestamp edit_time) {
        this.edit_time = edit_time;
    }

    public Timestamp getRecycle_time() {
        return recycle_time;
    }

    public void setRecycle_time(Timestamp recycle_time) {
        this.recycle_time = recycle_time;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public long getViews() {
        return views;
    }

    public void setViews(long views) {
        this.views = views;
    }

    public long getStars() {
        return stars;
    }

    public void setStars(long stars) {
        this.stars = stars;
    }

    public long getLikes() {
        return likes;
    }

    public void setLikes(long likes) {
        this.likes = likes;
    }

    public long getPartition() {
        return partition;
    }

    public void setPartition(long partition) {
        this.partition = partition;
    }
}
